<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<html>
<head>
<!-- Copyright 1997 The Open Group, All Rights Reserved -->
<title>fgetwc</title>
</head><body bgcolor=white>
<center>
<font size=2>
The Single UNIX &reg; Specification, Version 2<br>
Copyright &copy; 1997 The Open Group

</font></center><hr size=2 noshade>
<h4><a name = "tag_000_005_068">&nbsp;</a>NAME</h4><blockquote>
fgetwc - get a wide-character code from a stream
</blockquote><h4><a name = "tag_000_005_069">&nbsp;</a>SYNOPSIS</h4><blockquote>
<pre><code>

#include &lt;<a href="stdio.h.html">stdio.h</a>&gt;
#include &lt;<a href="wchar.h.html">wchar.h</a>&gt;

wint_t fgetwc(FILE *<i>stream</i>);
</code>
</pre>
</blockquote><h4><a name = "tag_000_005_070">&nbsp;</a>DESCRIPTION</h4><blockquote>
The
<i>fgetwc()</i>
function obtains the next character (if present)
from the input stream pointed to by
<i>stream</i>,
converts that to the corresponding wide-character code
and advances the associated file position indicator for the
stream (if defined).
<p>
If an error occurs, the resulting value of the file position
indicator for the stream is indeterminate.
<p>
The
<i>fgetwc()</i>
function may mark the
<i>st_atime</i>
field of the file associated with
<i>stream</i>
for update.
The
<i>st_atime</i>
field will be marked for update by the first successful
execution of
<i><a href="fgetc.html">fgetc()</a></i>,
<i><a href="fgets.html">fgets()</a></i>,
<i>fgetwc()</i>,
<i><a href="fgetws.html">fgetws()</a></i>,
<i><a href="fread.html">fread()</a></i>,
<i><a href="fscanf.html">fscanf()</a></i>,
<i><a href="getc.html">getc()</a></i>,
<i><a href="getchar.html">getchar()</a></i>,
<i><a href="gets.html">gets()</a></i>
or
<i><a href="scanf.html">scanf()</a></i>
using
<i>stream</i>
that returns data not supplied by a prior call to
<i><a href="ungetc.html">ungetc()</a></i>
or
<i><a href="ungetwc.html">ungetwc()</a></i>.
</blockquote><h4><a name = "tag_000_005_071">&nbsp;</a>RETURN VALUE</h4><blockquote>
Upon successful completion the
<i>fgetwc()</i>
function returns the wide-character code of the character read from the input
stream pointed to by
<i>stream</i>
converted to a type
<b>wint_t</b>.
If the stream
is at end-of-file, the end-of-file indicator for
the stream is set and
<i>fgetwc()</i>
returns WEOF.
If a read error occurs, the error indicator for the stream is set,
<i>fgetwc()</i>
returns WEOF and sets
<i>errno</i>
to indicate the error.
</blockquote><h4><a name = "tag_000_005_072">&nbsp;</a>ERRORS</h4><blockquote>
The
<i>fgetwc()</i>
function will fail if data needs to be read and:
<dl compact>

<dt>[EAGAIN]<dd>
The O_NONBLOCK flag is set for the file descriptor underlying
<i>stream</i>
and the process would be delayed in the
<i>fgetwc()</i>
operation.

<dt>[EBADF]<dd>
The file descriptor underlying
<i>stream</i>
is not a valid file descriptor open for reading.

<dt>[EINTR]<dd>
The read operation was terminated due to the receipt
of a signal, and no data was transferred.

<dt>[EIO]<dd>
A physical I/O error has occurred, or
the process is in a background process group attempting to read
from its controlling terminal, and either the process is ignoring or
blocking the SIGTTIN signal or the process group is orphaned.
This error may also be generated for implementation-dependent
reasons.

<dt>[EOVERFLOW]<dd>
The file is a regular file and an attempt was made to read at or beyond
the offset maximum associated with the corresponding stream.

</dl>
<p>
The
<i>fgetwc()</i>
function may fail if:
<dl compact>

<dt>[ENOMEM]<dd>
Insufficient storage space is available.

<dt>[ENXIO]<dd>
A request was made of a non-existent device, or the request was
outside the capabilities of the device.

<dt>[EILSEQ]<dd>
The data obtained from the input stream does not form a valid character.

</dl>
</blockquote><h4><a name = "tag_000_005_073">&nbsp;</a>EXAMPLES</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_005_074">&nbsp;</a>APPLICATION USAGE</h4><blockquote>
The
<i><a href="ferror.html">ferror()</a></i>
or
<i><a href="feof.html">feof()</a></i>
functions must be used to distinguish between
an error condition and an end-of-file condition.
</blockquote><h4><a name = "tag_000_005_075">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>
None.
</blockquote><h4><a name = "tag_000_005_076">&nbsp;</a>SEE ALSO</h4><blockquote>
<i><a href="feof.html">feof()</a></i>,
<i><a href="ferror.html">ferror()</a></i>,
<i><a href="fopen.html">fopen()</a></i>,
<i><a href="stdio.h.html">&lt;stdio.h&gt;</a></i>,
<i><a href="wchar.h.html">&lt;wchar.h&gt;</a></i>.
</blockquote><h4>DERIVATION</h4><blockquote>
Derived from the MSE working draft.
</blockquote><hr size=2 noshade>
<center><font size=2>
UNIX &reg; is a registered Trademark of The Open Group.<br>
Copyright &copy; 1997 The Open Group
<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]

</font></center><hr size=2 noshade>
</body></html>

